<?php
//声明一个抽象类，要使用abstract关键字标识
header("Content-Type: text/html; charset=utf-8");
    abstract class Person{
    	protected $name;
    	protected $country;

    	function __construct($name="",$country="china"){
    		$this -> name = $name;
    		$this -> country = $country;
    	}

    	abstract function say();
    	abstract function eat();

    	function run(){
    		echo "用两条腿走路<br>";

    	}
    }

    class ChineseMan extends Person{

    	function say(){
    		echo $this -> name."是".$this -> country."人,讲汉语<br>";
    	}

    	function eat(){
    		echo $this -> name."使用筷子吃饭<br>";

    	}
    }

    class Americans extends Person{

    	function say(){
    		echo $this -> name."是".$this -> country."人,讲英语<br>";
    	}
    	function eat(){
    		echo $this -> name."使用刀子和叉子吃饭<br>";
    	}
    }

    $chineseMan = new ChineseMan("高洛峰","中国");
    $americans  = new Americans("alex","美国");

    $chineseMan -> say();
    $chineseMan -> eat();

    $americans -> say();
    $americans -> eat();

